﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32.SafeHandles;
using Goldlight.Mvvm.Base.Infrastructure;
using System.IO;
using System.ComponentModel.Composition;

namespace Goldlight.Mvvm.Interfaces
{
    /// <summary>
    /// This interface covers the features that are going to be made available for using
    /// file based Kernel Transaction Manager features.
    /// </summary>
    [InheritedExport]
    public interface IKTM
    {
        /// <summary>
        /// Perform a transacted file copy.
        /// </summary>
        /// <param name="existingFileName">The path to the original file.</param>
        /// <param name="newFileName">The path to the copied file.</param>
        /// <param name="callback">Callback to the file copy progress method.</param>
        /// <param name="flags">Any <see cref="NativeMethods.CopyFileFlags"/> to be applied.</param>
        /// <returns>True if successful, false otherwise.</returns>
        bool TxCopy(FileInfo existingFileName, string newFileName, NativeMethods.CopyProgressCallback callback, NativeMethods.CopyFileFlags flags);
        /// <summary>
        /// Perform a transacted file copy.
        /// </summary>
        /// <param name="existingFileName">The path to the original file.</param>
        /// <param name="newFileName">The path to the copied file.</param>
        /// <param name="callback">Callback to the file copy progress method.</param>
        /// <returns>True if successful, false otherwise.</returns>
        bool TxCopy(FileInfo existingFileName, string newFileName, NativeMethods.CopyProgressCallback callback);
        bool TxCreateDirectory(string path);
        SafeFileHandle TxCreateFile(string fileName, FileAccess fileAccess, FileShare fileShare, FileMode fileMode);
        bool TxDelete(DirectoryInfo value, bool recursive);
        bool TxDelete(FileInfo value);
        bool TxDelete(DirectoryInfo value);
        bool TxMove(FileInfo existingFileName, string newFileName, NativeMethods.CopyProgressCallback callback, NativeMethods.MoveFileFlags flags);
        bool TxMove(FileInfo existingFileName, string newFileName, NativeMethods.CopyProgressCallback callback);
    }
}
